package com.chy.controller;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chy.common.R;
import com.chy.entity.Range;
import com.chy.service.RangeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/range")
public class RangeController {

    @Autowired
    private RangeService rangeService;

    @PostMapping("/add")
    public R addRange(@RequestBody Map<String, Object> params) {
        return rangeService.addRange(params);
    }

    @PostMapping("/list")
    public R<Page> getRangeList(@RequestBody Map<String, Object> params) {
        return R.success(rangeService.getRangeList(params));
    }
}
